package com.example.permission.myjbm.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.example.jbmsuppliers.R;
import com.example.permission.myjbm.config.Config;
import com.example.permission.myjbm.utils.ImageLoaderInit;
import com.jbm.jbmsupplier.util.InfoAttachmentEntity;

import java.util.List;

/**
 * 首页面图片适配器
 * 朋友圈中的图片列表
 */
public class MyFragmentAdapter_gv extends BaseAdapter{
    private List<InfoAttachmentEntity> attList;
    private Context c;
    public MyFragmentAdapter_gv(List<InfoAttachmentEntity> attList, Context c){
            this.attList=attList;
        this.c=c;
    }

    @Override
    public int getCount() {
        return attList.size();
    }

    @Override
    public Object getItem(int position) {
        return attList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView=View.inflate(c, R.layout.dsy_home_grid_item,null);
        ImageView img = (ImageView) convertView.findViewById(R.id.imageView2);
        ImageLoaderInit.getInstance().photoShow(Config.PHOTOPATH+attList.get(position).getThumAttPath(),img);
        return convertView;
    }
}
